package com.tanhua.model.vo;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.tanhua.model.domain.Announcement;
import com.tanhua.model.domain.BasePojo;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.data.mongodb.core.mapping.Document;

import java.io.Serializable;
import java.util.Date;

/**
 * @author Xiao
 * @version 1.0
 * @description
 * @date 2021/10/30
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class AnnouncementVO implements Serializable {
    private static final long serialVersionUID = 1L;
    private String id;  //公告id
    private String title;   //标题
    private String description; //描述
    private Date created;   //创建时间
    private Date updated;   //修改时间

    public static AnnouncementVO init(Announcement announcement) {
        AnnouncementVO announcementVO = new AnnouncementVO();
        BeanUtils.copyProperties(announcement, announcementVO);
        announcementVO.setId(announcement.getId().toString());
        return announcementVO;
    }
}
